﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AAA.DataTransfer
{
    public class StringGroupAction : IGroupAction
    {
        private string _strInitValue = "";

        public object InitValue
        {
            get { return _strInitValue; }
            set { _strInitValue = value.ToString(); }
        }

        private string _strDelimeter;
        public StringGroupAction(string strDelimeter)
        {
            _strDelimeter = strDelimeter;
        }
        #region IGroupAction 成員

        public object Group(object oFirst, object oSecond)
        {
            try
            {
                if ((oFirst == null) || (oFirst is DBNull))
                    oFirst = InitValue;
                if ((oSecond == null) || (oFirst is DBNull))
                    oSecond = InitValue;

                return oFirst.ToString() + _strDelimeter + oSecond.ToString();
            }
            catch { }
            return null;
        }

        #endregion
    }
}
